//
//  ByAuthenticationInfoVC.m
//  hutouben_ios
//
//  Created by justiOS on 16/11/30.
//  Copyright © 2016年 mc. All rights reserved.
//

#import "ByAuthenticationInfoVC.h"

// vc
#import "ByDriverAuthenticationVC.h"                 // 认证

@interface ByAuthenticationInfoVC ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *table;   // 主table
@property (nonatomic, strong) NSMutableArray *dataAry;
@end

@implementation ByAuthenticationInfoVC

- (NSMutableArray *)dataAry {
    if (_dataAry == nil) {
        _dataAry = [NSMutableArray arrayWithCapacity:5];
    }
    return _dataAry;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"认证信息";
    [self addLeftBackBarButtonItem];
    [self createTableView];
    [self createButton];
}
- (void)createButton {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, SCREEN_HEIGHT - 64 - 49, SCREEN_WIDTH, 49);
    button.backgroundColor = HTB_THEME_COLOR;
    button.titleLabel.font = FONT(16);
    [button setTitle:@"修改认证信息" forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(changeInfoActon:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)createTableView {
    self.table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT -64 - 49) style:UITableViewStylePlain];
    self.table.backgroundColor = HTB_BG_GRAY;
    self.table.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.table.delegate = self;
    self.table.dataSource = self;
    [self.view addSubview:_table];
    
}
#pragma mark - UITableViewDataSource UITableViewDelegate
// 设置组数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
// 设置行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}
// 设置单元格属性
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
        cell.backgroundColor = [UIColor clearColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, SCREEN_WIDTH, 20)];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = FONT(16);
    titleLabel.textColor = HTB_TEXT_COLOR2;
    if (indexPath.row == 0) {
        titleLabel.text = @"身份证正面信息";
    }else{
        titleLabel.text = @"行驶证正本";
    }
    [cell addSubview:titleLabel];
    
    UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(25, titleLabel.bottom + 15, SCREEN_WIDTH - 50, (SCREEN_WIDTH - 50)*2/3.0)];
    imageview.image = [UIImage imageWithColor:[UIColor yellowColor]];
    imageview.layer.cornerRadius = 5;
    imageview.layer.masksToBounds = YES;
    imageview.layer.borderWidth = 1;
    imageview.layer.borderColor = HTB_THEME_COLOR.CGColor;
    [cell addSubview:imageview];
    
    
    
    return cell;
    
}
// 设置单元格行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        return (SCREEN_WIDTH - 50)*2/3.0 + 60;
    }
    return (SCREEN_WIDTH - 50)*2/3.0 + 80;
}


// 单元格点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
    
}


#pragma mark 点击事件
- (void)changeInfoActon:(UIButton *)button {
    ByDriverAuthenticationVC *vc = [[ByDriverAuthenticationVC alloc] init];
    [self by_normalPush:vc hasNavi:YES];

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
